﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace project
{
    public partial class CustomerAdd : Form
    {
        public CustomerAdd()
        {
            InitializeComponent();
        }

        private void btn_tuichu_Click(object sender, EventArgs e)
        {
            
          
        }

        private void btn_Add_Click(object sender, EventArgs e)
        {
            string name= this.textBoxName.Text;
            string address = this.textBoxAddress.Text;
            string sex="女";
            if (this.radioButton1.Checked)
            {
                sex = "男";
            }
            string employer = this.textBoxEmployer.Text;
            string phone = this.textBoxPhone.Text;
            string sql = "INSERT INTO [dbo].[Customer]([CustomerName],[Address],[Phone],[Employer],[Sex])VALUES('{0}','{1}','{2}','{3}','{4}')";
            sql = string.Format(sql,name,address,phone,employer,sex);
            int re= DBHelper.ExecuteNonQuery(sql);
            if (re>0)
            {
                MessageBox.Show("添加成功");
                return;
            }
            MessageBox.Show("添加失败！");
            
        }

        private void CustomerAdd_Load(object sender, EventArgs e)
        {
            
        }
    }
}
